package com.dhl.stategy.comparter;

import com.dhl.stategy.comparter.cat.CatPriceComparator;
import com.dhl.stategy.comparter.dog.DogHiegitComparator;
import com.dhl.stategy.comparter.dog.DogWightComparator;

import java.math.BigDecimal;
import java.util.Arrays;
import java.util.Comparator;

/**
 * @author YHS
 */
public class ClientMain {
    public static void main(String[] args) {
        Cat[] cats = new Cat[]{new Cat(5), new Cat(20), new Cat(15), new Cat(10)};
        Compare<Cat> catCompare = new Compare<>();
        catCompare.compare(cats,new CatPriceComparator());
        System.out.println("cats = " + Arrays.toString(cats));

        Compare<Dog> dogsCompare = new Compare<>();

        Dog[] dogs01 = new Dog[]{new Dog(30,15), new Dog(20,10), new Dog(15,4), new Dog(40,5)};
        dogsCompare.compare(dogs01,new DogHiegitComparator());
        System.out.println("dogs01 = " + Arrays.toString(dogs01));
        Dog[] dogs02 = new Dog[]{new Dog(5,15), new Dog(20,10), new Dog(15,4), new Dog(40,5)};
        dogsCompare.compare(dogs02,new DogWightComparator());
        System.out.println("dogs02 = " + Arrays.toString(dogs02));


        Integer [] ints01 = {1,2,3,6,5,4,7,8,9};
        Integer [] ints02 = {2,4,3,6,5,4,7,8,9};
        Compare<Integer> integerCompare = new Compare<>();
        integerCompare.compare(ints01, Comparator.comparingInt(o -> o));
        integerCompare.compare(ints02, Comparator.comparingInt(o -> o));
        System.out.println("ints01 = " + Arrays.toString(ints01));
        System.out.println("ints02 = " + Arrays.toString(ints02));
    }
}
